/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author Vito
 */
@Entity
@Table(name = "ESTERNI", catalog = "", schema = "APP", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"ID_EST"})})
@NamedQueries({
    @NamedQuery(name = "Esterni.findAll", query = "SELECT e FROM Esterni e"),
    @NamedQuery(name = "Esterni.findByIdEst", query = "SELECT e FROM Esterni e WHERE e.idEst = :idEst"),
    @NamedQuery(name = "Esterni.findByIdInt", query = "SELECT e FROM Esterni e WHERE e.idInt = :idInt")})
public class Esterni implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_EST", nullable = false, length = 50)
    private String idEst;
    @JoinColumn(name = "ID_INT", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    private Utente idInt;

    public Esterni() {
    }

    public Esterni(String idEst, Utente idInt) {
        this.idEst = idEst;
        this.idInt = idInt;
    }

    public String getIdEst() {
        return idEst;
    }

    public void setIdEst(String idEst) {
        this.idEst = idEst;
    }

    public Utente getIdInt() {
        return idInt;
    }

    public void setIdInt(Utente idInt) {
        this.idInt = idInt;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEst != null ? idEst.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Esterni)) {
            return false;
        }
        Esterni other = (Esterni) object;
        if ((this.idEst == null && other.idEst != null) || (this.idEst != null && !this.idEst.equals(other.idEst))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Esterni[idEst=" + idEst + "]";
    }

}
